import requests
from bs4 import BeautifulSoup
url="http://quotes.toscrape.com/page/{}/"
for a in range(1,999):
    r=requests.get(url.format(a))
    h=r.text
    x=BeautifulSoup(h,'lxml')
    b=x.select('span.text')
    c=x.select('small.author')
    list1=[]
    list2=[]
    if b:
        print("正在访问",url.format(a))
        for i in b:
            list1.append(i.text)
        for j in c:
            list2.append(j.text)
        n=0
        for each in list2:
            print(each,"说过",list1[n])
            n+=1
    else:
        break
